package com.web.expspringboot.controller;

import com.web.expspringboot.dto.Contact;
import com.web.expspringboot.entity.ProductSt;
import com.web.expspringboot.service.PurchaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/purchase")
public class PurchaseController {
    @Autowired
    PurchaseService ps;

    //获取用户买到的商品
    @RequestMapping("/purchaseProducts")
    public List<ProductSt> getPurchaseProducts(){
        return ps.getPurchaseProducts();
    }

    //获取买家、卖家联系方式
    @RequestMapping("/getContact")
    public Contact getContact(@RequestParam("productId") long productId){
        return ps.getContact(productId);
    }
}

